home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / tool_inc.zip / DTOF.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  48 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. function dtof(B: double): real;
  14.    {convert 8 byte double to real}
  15. var
  16.    PasReal:  real;
  17.    R:        array [0..5] of byte absolute PasReal;
  18. begin
  19.    PasReal := 0;
  20.    move(B[2],R[1],5);
  21.    R[0] := B[7];
  22.    dtof := PasReal;
  23. end;
  24.  
  25. function dtol(B: double): longint;
  26.    {convert 8 byte double to long integer}
  27. begin
  28.    dtol := trunc(dtof(B));
  29. end;
  30.  
  31. procedure ftod(PasReal: real; var B: double);
  32.    {convert real to 8 byte double}
  33. var
  34.    R: array [0..5] of byte absolute PasReal;
  35. begin
  36.    fillchar(B[0],8,0);
  37.    B[7] := R[0];
  38.    move(R[1],B[2],5);
  39. end;
  40.  
  41.  
  42. (*-----------------------------------------------------------------*)
  43. procedure incd(var d: double; n: real);
  44. begin
  45.    ftod( int(dtof(d)) + n, d );
  46. end;
  47.  
  48.